//
//  main.m
//  03_HomeWork
//
//  Created by dllo on 16/7/6.
//  Copyright © 2016年 LST. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Book.h"
#import "MangerBook.h"



int main(int argc, const char * argv[]) {
    
    
    /* 截取字符串 "20|https://www.baidu.com" 中 "|" 前面和后⾯的字符串, 并输出
     向可变数组里存储 int、float、double、BOOL类型等数据(不能使用字面量)
     实现图书管理系统(BookManager类)：
     使用数组管理所有书籍(Book类)。
     BookManager类属性数组可以添加、删除。
     可以从数组根据书名查找书籍，并修改书籍的价格。
     展示所有书籍清单（书名）*/
    
    // 1 截取字符串
    NSString *str = @"20|https://www.baidu.com";
    NSArray *arr = [str componentsSeparatedByString:@"|"];
    NSLog(@"%@", arr);
    
    // 2.可变数组
    
    NSNumber *aNum = [NSNumber numberWithInt:10];
    NSNumber *bNum = [NSNumber numberWithFloat:10];
    NSNumber *cNum = [NSNumber numberWithDouble:10];
    NSNumber *dNum = [NSNumber numberWithBool:1];
    NSMutableArray *mutArray = [NSMutableArray arrayWithObjects:aNum, bNum, cNum, dNum, nil];
    NSLog(@"%@", mutArray);
    
    // 3.图书馆
    Book *book1 = [Book bookWithName:@"西游记" Price:10];
    Book *book2 = [Book bookWithName:@"水浒传" Price:20];
    Book *book3 = [Book bookWithName:@"三国演义" Price:15];
    Book *book4 = [Book bookWithName:@"红楼梦" Price:17];
    
    MangerBook *manager = [[MangerBook alloc] init];
    manager.allBook = [NSMutableArray array];
    [manager.allBook addObject:book1];
    [manager.allBook addObject:book2];
    [manager.allBook addObject:book3];
    [manager.allBook addObject:book4];
    [manager display];
    [manager.allBook removeObject:book1];
    [manager display];
    [manager searchBook:book1];

    return 0;
}







